Program add_type_episode_data
      character*6 ticker
      character*8 cusp
      integer(kind=8):: nshrs,nvalue,jvalue,ivol,numshrs
!      dimension ntype(1264)
      dimension ntype(1276)
!      open(unit=10,file='e:\FIS\episode_data.txt')
!      open(unit=11,file='e:\FIS\episode_results.txt')
!      open(unit=99,file='e:\FIS_duration\episode_date_type.txt')
      open(unit=10,file='e:\FIS\episode_data_rep.txt')
      open(unit=11,file='e:\FIS\episode_results_rep.txt')
      open(unit=99,file='e:\FIS_duration\episode_data_type_rep.txt')
      iend=0
!      do 700 i=1,1264
      do 700 i=1,1276
700        read(11,1100)ntype(i)
1100  format(6x,i1)          
      i=0
1     i=i+1
2     read(10,1000,end=900)nep,jast,jdate,cusp,ticker,itickt,numshrs,age,favg,fmax,fmin,fstd,iperm,price,ivol,retrn,ishrout,vwret,util,nshrs      
1000  format(1x,i4,2(1x,i8),1x,a8,2x,a6,4x,i9,1x,i14,5(1x,f11.4),1x,i5,1x,f9.2,1x,i10,1x,f10.6,1x,i9,1x,f9.6,1x,f6.2,1x,i13)    
      write(99,9900)nep,ntype(nep),jast,jdate,cusp,ticker,itickt,numshrs,age,favg,fmax,fmin,fstd,iperm,price,ivol,retrn,ishrout,vwret,util,nshrs      
9900  format(1x,i4,1x,i1,2(1x,i8),1x,a8,2x,a6,4x,i9,1x,i14,5(1x,f11.4),1x,i5,1x,f9.2,1x,i10,1x,f10.6,1x,i9,1x,f9.6,1x,f6.2,1x,i13)  
      go to 1
900   continue
      stop
end program add_type_episode_data